<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.7.0" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=6.4.2" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/apple-touch-icon-next.png?v=6.4.2">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/favicon-32x32-next.png?v=6.4.2">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/favicon-16x16-next.png?v=6.4.2">


  <link rel="mask-icon" href="/blog/images/logo.svg?v=6.4.2" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Gemini',
    version: '6.4.2',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="使用Spring Boot和Vue.js开发一个生成页面的脚手架，可以大大提高Web开发的效率和可维护性。在这个脚手架中，我们可以提供一些页面模板，用户可以在这些模板的基础上快速生成自己的页面，并将这些页面存储在指定的位置。">
<meta name="keywords" content="页面静态化">
<meta property="og:type" content="article">
<meta property="og:title" content="页面静态化技术">
<meta property="og:url" content="https://xit-edu.cn/2023/03/25/blog/page-statics/page-statics/index.html">
<meta property="og:site_name" content="厦门工学院">
<meta property="og:description" content="使用Spring Boot和Vue.js开发一个生成页面的脚手架，可以大大提高Web开发的效率和可维护性。在这个脚手架中，我们可以提供一些页面模板，用户可以在这些模板的基础上快速生成自己的页面，并将这些页面存储在指定的位置。">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://xit-edu.cn/blog/2023/03/25/blog/page-statics/page-statics/1.jpg">
<meta property="og:image" content="https://xit-edu.cn/blog/2023/03/25/blog/page-statics/page-statics/2.png">
<meta property="og:updated_time" content="2023-03-25T13:31:32.783Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="页面静态化技术">
<meta name="twitter:description" content="使用Spring Boot和Vue.js开发一个生成页面的脚手架，可以大大提高Web开发的效率和可维护性。在这个脚手架中，我们可以提供一些页面模板，用户可以在这些模板的基础上快速生成自己的页面，并将这些页面存储在指定的位置。">
<meta name="twitter:image" content="https://xit-edu.cn/blog/2023/03/25/blog/page-statics/page-statics/1.jpg">






  <link rel="canonical" href="https://xit-edu.cn/2023/03/25/blog/page-statics/page-statics/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>页面静态化技术 | 厦门工学院</title>
  






  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?d3f181d3d99fc3c240567d5b682eebd1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>






  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">厦门工学院</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">软件研发工作室</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/blog/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/blog/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/blog/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/blog/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-works1">
    <a href="/blog/works1/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-sitemap"></i> <br>H5小游戏1</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-works2">
    <a href="/blog/works2/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>H5小游戏2</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-fiction">
    <a href="/blog/fiction/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br>大将军归来</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/blog/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://xit-edu.cn/blog/2023/03/25/blog/page-statics/page-statics/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="对美好事物的向往，心中要充满强烈的愿望！">
      <meta itemprop="description" content="沉淀下来的知识，才是真正的财富！">
      <meta itemprop="image" content="/blog/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="厦门工学院">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">页面静态化技术
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2023-03-25 12:00:00 / 修改时间：21:31:32" itemprop="dateCreated datePublished" datetime="2023-03-25T12:00:00+08:00">2023-03-25</time>
            

            
              

              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/blog/categories/服务端/" itemprop="url" rel="index"><span itemprop="name">服务端</span></a></span>

                
                
                  ，
                
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/blog/categories/服务端/页面静态化/" itemprop="url" rel="index"><span itemprop="name">页面静态化</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>使用Spring Boot和Vue.js开发一个生成页面的脚手架，可以大大提高Web开发的效率和可维护性。在这个脚手架中，我们可以提供一些页面模板，用户可以在这些模板的基础上快速生成自己的页面，并将这些页面存储在指定的位置。</p>
<a id="more"></a>
<h3 id="创建Spring-Boot项目"><a href="#创建Spring-Boot项目" class="headerlink" title="创建Spring Boot项目"></a>创建Spring Boot项目</h3><p>使用Spring Initializr或其他方式创建一个基于Spring Boot的Web应用程序，添加所需的依赖项和配置文件。例如，我们可以添加Spring Web，Spring Thymeleaf等依赖项。</p>
<h3 id="创建页面模板"><a href="#创建页面模板" class="headerlink" title="创建页面模板"></a>创建页面模板</h3><h4 id="什么是模板引擎"><a href="#什么是模板引擎" class="headerlink" title="什么是模板引擎"></a>什么是模板引擎</h4><ul>
<li>在项目中创建页面模板，可以使用Thymeleaf、FreeMarker等模板引擎。页面模板通常包括HTML、CSS和JavaScript代码，其中一些部分时可变的。</li>
<li>模板引擎的工作原理通常是将模板文件中的静态文本和动态占位符进行解析，并将器转化为实际的文本输出。动态占位符通常包含变量、条件语句、循环语句、函数调用等，这些占位符将在运行时由实际数据填充。</li>
<li>对于模板引擎的理解，可以这样形象的做一个类比：<strong>开会！</strong> 相信你在上学初高中时候每次开会都要提前布置场地、拿小板凳、收拾场地。而你上了大学之后每次开会再也不去大操场了,每次开会都去学校的大会议室，桌子板凳音响主席台齐全，来个人即可，还可复用……。模板引擎的功能就类似我们的会议室开会一样开箱即用，将模板设计好之后直接填充数据即可而不需要重新设计整个页面。提高页面、代码的复用性。</li>
</ul>
<img src="/blog/2023/03/25/blog/page-statics/page-statics/1.jpg">
<h4 id="为什么要使用Thymeleaf模板"><a href="#为什么要使用Thymeleaf模板" class="headerlink" title="为什么要使用Thymeleaf模板"></a>为什么要使用Thymeleaf模板</h4><ul>
<li><strong>动静分离：</strong> Thymeleaf选用html作为模板页，这是任何一款其他模板引擎做不到的！Thymeleaf使用html通过一些特定标签语法代表其含义，但并未破坏html结构，即使无网络、不通过后端渲染也能在浏览器成功打开，大大方便界面的测试和修改。</li>
<li><strong>开箱即用：</strong> Thymeleaf提供标准和Spring标准两种方言，可以直接套用模板实现JSTL、 OGNL表达式效果，避免每天套模板、改JSTL、改标签的困扰。同时开发人员也可以扩展和创建自定义的方言。</li>
<li><strong>Springboot官方大力推荐和支持：</strong>Springboot官方做了很多默认配置，开发者只需编写对应html即可，大大减轻了上手难度和配置复杂度。</li>
</ul>
<h4 id="编写一个Thymeleaf模板"><a href="#编写一个Thymeleaf模板" class="headerlink" title="编写一个Thymeleaf模板"></a>编写一个Thymeleaf模板</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html xmlns:th=&quot;http://www.thymeleaf.org&quot;&gt;</span><br><span class="line">&lt;head&gt;</span><br><span class="line">&lt;title&gt;Page Template&lt;/title&gt;</span><br><span class="line">&lt;/head&gt;</span><br><span class="line">&lt;body&gt;</span><br><span class="line">&lt;h1 th:text=&quot;$&#123;title&#125;&quot;&gt;我是离线标题&lt;/h1&gt;</span><br><span class="line">&lt;p th:text=&quot;$&#123;content&#125;&quot;&gt;我是离线数据&lt;/p&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure>
<p>这个页面模板包含了一个${title}和一个${content}占位符，用于后面填充数据<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line">&lt;html&gt;</span><br><span class="line">&lt;head&gt;</span><br><span class="line">&lt;title&gt;Page Template&lt;/title&gt;</span><br><span class="line">&lt;/head&gt;</span><br><span class="line">&lt;body&gt;</span><br><span class="line">&lt;h1&gt;Page Title&lt;/h1&gt;</span><br><span class="line">&lt;p&gt;Page Content&lt;/p&gt;</span><br><span class="line">&lt;/body&gt;</span><br><span class="line">&lt;/html&gt;</span><br></pre></td></tr></table></figure></p>
<p>下图左侧为直接打开的静态页面，而右侧是通过网络访问服务端返回的动态界面<br><img src="/blog/2023/03/25/blog/page-statics/page-statics/2.png"></p>
<h4 id="常用的thymeleaf标签"><a href="#常用的thymeleaf标签" class="headerlink" title="常用的thymeleaf标签"></a>常用的thymeleaf标签</h4><table>
<thead>
<tr>
<th><strong>关键字</strong></th>
<th><strong>功能介绍</strong></th>
<th><strong>案例</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>th:id</td>
<td>替换id</td>
<td><code>&lt;input th:id=&quot;&#39;xxx&#39; + ${collect.id}&quot;/&gt;</code></td>
</tr>
<tr>
<td>th:text</td>
<td>文本替换</td>
<td><code>&lt;p th:text=&quot;${collect.description}&quot;&gt;description&lt;/p&gt;</code></td>
</tr>
<tr>
<td>th:utext</td>
<td>支持html的文本替换</td>
<td><code>&lt;p th:utext=&quot;${htmlcontent}&quot;&gt;conten&lt;/p&gt;</code></td>
</tr>
<tr>
<td>th:object</td>
<td>替换对象</td>
<td><code>&lt;div th:object=&quot;${session.user}&quot;&gt;</code></td>
</tr>
<tr>
<td>th:value</td>
<td>属性赋值</td>
<td><code>&lt;input th:value=&quot;${user.name}&quot; /&gt;</code></td>
</tr>
<tr>
<td>th:with</td>
<td>变量赋值运算</td>
<td><code>&lt;div th:with=&quot;isEven=${prodStat.count}%2==0&quot;&gt;&lt;/div&gt;</code></td>
</tr>
<tr>
<td>th:style</td>
<td>设置样式</td>
<td><code>th:style=&quot;&#39;display:&#39; + @{(${sitrue} ? &#39;none&#39; : &#39;inline-block&#39;)} + &#39;&#39;&quot;</code></td>
</tr>
<tr>
<td>th:onclick</td>
<td>点击事件</td>
<td><code>th:onclick=&quot;&#39;getCollect()&#39;&quot;</code></td>
</tr>
<tr>
<td>th:each</td>
<td>属性赋值</td>
<td><code>tr th:each=&quot;user,userStat:${users}&quot;&gt;</code></td>
</tr>
<tr>
<td>th:if</td>
<td>判断条件</td>
<td><code>&lt;a th:if=&quot;${userId == collect.userId}&quot; &gt;</code></td>
</tr>
<tr>
<td>th:unless</td>
<td>和th:if判断相反</td>
<td><code>&lt;a th:href=&quot;@{/login}&quot; th:unless=${session.user != null}&gt;Login&lt;/a&gt;</code></td>
</tr>
<tr>
<td>th:href</td>
<td>链接地址</td>
<td><code>&lt;a th:href=&quot;@{/login}&quot; th:unless=${session.user != null}&gt;Login&lt;/a&gt; /&gt;</code></td>
</tr>
<tr>
<td>th:switch</td>
<td>多路选择 配合th:case 使用</td>
<td><code>&lt;div th:switch=&quot;${user.role}&quot;&gt;</code></td>
</tr>
<tr>
<td>th:case</td>
<td>th:switch的一个分支</td>
<td><code>&lt;p th:case=&quot;&#39;admin&#39;&quot;&gt;User is an administrator&lt;/p&gt;</code></td>
</tr>
<tr>
<td>th:fragment</td>
<td>布局标签，定义一个代码片段，方便其它地方引用</td>
<td><code>&lt;div th:fragment=&quot;alert&quot;&gt;</code></td>
</tr>
<tr>
<td>th:include</td>
<td>布局标签，替换内容到引入的文件</td>
<td><code>&lt;head th:include=&quot;layout :: htmlhead&quot; th:with=&quot;title=&#39;xx&#39;&quot;&gt;&lt;/head&gt; /&gt;</code></td>
</tr>
<tr>
<td>th:replace</td>
<td>布局标签，替换整个标签到引入的文件</td>
<td><code>&lt;div th:replace=&quot;fragments/header :: title&quot;&gt;&lt;/div&gt;</code></td>
</tr>
<tr>
<td>th:selected</td>
<td>selected选择框 选中</td>
<td><code>th:selected=&quot;(${xxx.id} == ${configObj.dd})&quot;</code></td>
</tr>
<tr>
<td>th:src</td>
<td>图片类地址引入</td>
<td><code>&lt;img class=&quot;img-responsive&quot; alt=&quot;App Logo&quot; th:src=&quot;@{/img/logo.png}&quot; /&gt;</code></td>
</tr>
<tr>
<td>th:inline</td>
<td>定义js脚本可以使用变量</td>
<td><code>&lt;script type=&quot;text/javascript&quot; th:inline=&quot;javascript&quot;&gt;</code></td>
</tr>
<tr>
<td>th:action</td>
<td>表单提交的地址</td>
<td><code>&lt;form action=&quot;subscribe.html&quot; th:action=&quot;@{/subscribe}&quot;&gt;</code></td>
</tr>
<tr>
<td>th:remove</td>
<td>删除某个属性</td>
<td><code>&lt;tr th:remove=&quot;all&quot;&gt; 1.all:删除包含标签和所有的孩子。2.body:不包含标记删除,但删除其所有的孩子。3.tag:包含标记的删除,但不删除它的孩子。4.all-but-first:删除所有包含标签的孩子,除了第一个。5.none:什么也不做。这个值是有用的动态评估。</code></td>
</tr>
<tr>
<td>th:attr</td>
<td>设置标签属性，多个属性可以用逗号分隔</td>
<td><code>比如 th:attr=&quot;src=@{/image/aa.jpg},title=#{logo}&quot;，此标签不太优雅，一般用的比较少。</code></td>
</tr>
</tbody>
</table>
<h3 id="创建API接口"><a href="#创建API接口" class="headerlink" title="创建API接口"></a>创建API接口</h3><p>在Spring Boot中可以使用@RestController注解创建一个REST API。在API中，需要获取页面模板，并将其填充为所需的页面，并将其保存在指定位置。可以使用Java的File API来创建和包存文件。在生成页面文件之前，需要对页面模板进行适当处理，例如将页面中变量替换为具体的值、添加必要的CSS和JavaScript等。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">    @GetMapping(&quot;/page&quot;)</span><br><span class="line">public String getPage(@RequestParam String template, Model model) throws IOException &#123;</span><br><span class="line">        Context context = new Context(); //创建上下文</span><br><span class="line">        context.setVariable(&quot;title&quot;, &quot;Page Title&quot;);</span><br><span class="line">        context.setVariable(&quot;content&quot;, &quot;Page Content&quot;); //用来存储数据</span><br><span class="line">final String html = this.templateEngine.process(template, context); //渲染模板</span><br><span class="line"></span><br><span class="line">        String fileName = &quot;src/main/resources/templates/et.html&quot;; //生成的html文件</span><br><span class="line">        File file = new File(fileName); //创建文件</span><br><span class="line">        FileWriter writer1 = new FileWriter(file); //创建文件写入流</span><br><span class="line">        writer1.write(html); //写入文件</span><br><span class="line">        writer1.close(); //关闭流</span><br><span class="line">        return html; //返回html</span><br><span class="line">        &#125;</span><br></pre></td></tr></table></figure></p>
<h3 id="在Vue-js中使用AJAX或Axios等库调用API"><a href="#在Vue-js中使用AJAX或Axios等库调用API" class="headerlink" title="在Vue.js中使用AJAX或Axios等库调用API"></a>在Vue.js中使用AJAX或Axios等库调用API</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">export function getPage()&#123;</span><br><span class="line">        return request(&#123;</span><br><span class="line">        url: &apos;localhost:8080/address&apos;,</span><br><span class="line">        method: &apos;get&apos;,</span><br><span class="line">        &#125;)</span><br><span class="line">        &#125;</span><br></pre></td></tr></table></figure>
      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/页面静态化/" rel="tag"># 页面静态化</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blog/2022/07/03/blog/super-engineer/super-engineer/" rel="next" title="数字化时代的“超级工程师”">
                <i class="fa fa-chevron-left"></i> 数字化时代的“超级工程师”
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2024/10/19/blog/fault-docker-log/fault-docker-log/" rel="prev" title="Docker 容器日志清理">
                Docker 容器日志清理 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">对美好事物的向往，心中要充满强烈的愿望！</p>
              <p class="site-description motion-element" itemprop="description">沉淀下来的知识，才是真正的财富！</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/blog/archives/">
                
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/blog/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">22</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/blog/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">19</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#创建Spring-Boot项目"><span class="nav-number">1.</span> <span class="nav-text">创建Spring Boot项目</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建页面模板"><span class="nav-number">2.</span> <span class="nav-text">创建页面模板</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#什么是模板引擎"><span class="nav-number">2.1.</span> <span class="nav-text">什么是模板引擎</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#为什么要使用Thymeleaf模板"><span class="nav-number">2.2.</span> <span class="nav-text">为什么要使用Thymeleaf模板</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#编写一个Thymeleaf模板"><span class="nav-number">2.3.</span> <span class="nav-text">编写一个Thymeleaf模板</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#常用的thymeleaf标签"><span class="nav-number">2.4.</span> <span class="nav-text">常用的thymeleaf标签</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建API接口"><span class="nav-number">3.</span> <span class="nav-text">创建API接口</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#在Vue-js中使用AJAX或Axios等库调用API"><span class="nav-number">4.</span> <span class="nav-text">在Vue.js中使用AJAX或Axios等库调用API</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright"> &copy; <span itemprop="copyrightYear">2024</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">对美好事物的向往，心中要充满强烈的愿望！</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.9.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a> v6.4.2</div>




        








        
        <div>
          <a href="https://beian.miit.gov.cn/" target="_blank">闽ICP备15015722号-2</a>
        </div>
      </div>
     
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/blog/js/src/utils.js?v=6.4.2"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=6.4.2"></script>



  
  


  <script type="text/javascript" src="/blog/js/src/affix.js?v=6.4.2"></script>

  <script type="text/javascript" src="/blog/js/src/schemes/pisces.js?v=6.4.2"></script>



  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=6.4.2"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=6.4.2"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=6.4.2"></script>



  



  










  





  

  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
